<template>
    <div>
      <el-tree
        :data="data"
        :props="defaultProps" 
        node-key="catId"
        @node-click="handleNodeClick"
      >
      </el-tree>
    </div>
  </template>
  
  <script>
  /* eslint-disable */
  export default {
    data() {
      return {
        data:[],
        defaultProps: {
          children: "childrens",
          label: "name",
        }
      };
    },
    methods: {
      handleNodeClick(data, node, component) {
        this.$emit("nodeClick", data);
      },
      getCategory() {
        this.$http({
          url: this.$http.adornUrl("/product/category/queryCategoryByTree"),
          method: "get",
        }).then(({ data }) => {
          this.data = data.categoryTree;
        });
      },
    },
    created() {
      this.getCategory();
    },
  };
  </script>
  
  <style>
  </style>